﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.DialogUI {
    import flash.events.*;
    import flash.display.*;
    import flash.utils.*;
    import Classes.*;
    import Classes.util.*;

    public class InstantReadyDialog extends GenericDialog {

        public static const TYPE_GOODS_STORAGE:String = "GoodsStorage";
        public static const TYPE_NEED_MORE_STORAGE:String = "NeedMoreStorage";
        public static const SHIPS:String = "ships";
        public static const CROPS:String = "crops";
        public static const RESIDENCES:String = "residences";
        public static const NUM_ASSETS_TO_LOAD:int = 2;

        protected var m_marketComObj:Object;
        protected var m_numLoaded:int;
        private var m_harvestable:HarvestableResource;

        public function InstantReadyDialog(_arg1:HarvestableResource){
            this.m_harvestable = _arg1;
            super("instant_ready_dialog", _arg1.getTypeName(), 0, null, "instant_ready_dialog", _arg1.getTypeName(), true, 0);
        }
        override protected function createDialogView(_arg1:Dictionary):GenericDialogView{
            return (new InstantReadyDialogView(_arg1, this.m_harvestable));
        }
        override protected function loadAssets():void{
            super.loadAssets();
            Global.delayedAssets.get(DelayedAssetLoader.MARKET_ASSETS, this.makeAssets);
        }
        override protected function makeAssets(_arg1:DisplayObject, _arg2:String):void{
            if (_arg2 == DelayedAssetLoader.MARKET_ASSETS){
                this.m_marketComObj = _arg1;
                this.onAssetsLoaded();
            } else {
                super.makeAssets(_arg1, _arg2);
            };
        }
        override protected function onAssetsLoaded(_arg1:Event=null):void{
            this.m_numLoaded++;
            if (this.m_numLoaded == NUM_ASSETS_TO_LOAD){
                super.onAssetsLoaded();
            };
        }
        override protected function createAssetDict():Dictionary{
            var _local1:Dictionary = super.createAssetDict();
            _local1["card_available_unselected"] = this.m_marketComObj.marketItem;
            _local1["card_available_selected"] = this.m_marketComObj.marketItem;
            _local1["icon_cash"] = this.m_marketComObj.cash;
            _local1["icon_coins"] = this.m_marketComObj.coin;
            _local1["pop_lock"] = this.m_marketComObj.lockedArea;
            return (_local1);
        }

    }
}//package Display.DialogUI 
